package cn.trigram.jmx.hello_mbean;

import javax.management.Notification;
import javax.management.NotificationBroadcasterSupport;

/**
 * 定义消息广播器，也是一个MBean
 */
public class MyNotificationBroadcaster extends NotificationBroadcasterSupport
    implements MyNotificationBroadcasterMBean {

  private int seq = 0;

  public void hi() {
    //创建一个信息包 通知名称；谁发起的通知；序列号；发起通知时间；发送的消息
    Notification notify = new Notification("hi", this, ++seq, System.currentTimeMillis(), "How are you?");
    sendNotification(notify);
  }

}
